package es.alvsanand.webpage.common;
import java.util.Iterator;
import javax.faces.component.UIComponent;
public class FacesUtils {
public static UIComponent findComponent(UIComponent parent, String id) {
if (id.equals(parent.getId())) {
return parent;
}
Iterator<UIComponent> kids = parent.getFacetsAndChildren();
while (kids.hasNext()) {
UIComponent kid = kids.next();
UIComponent found = findComponent(kid, id);
if (found != null) {
return found;
}
}
return null;
}
}